package jnpf.zc.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.permission.service.AuthorizeService;
import jnpf.util.GeneraterSwapUtil;
import jnpf.util.ServletUtil;
import jnpf.util.UserProvider;
import jnpf.zc.entity.ZcglZcdjAreaEntity;
import jnpf.zc.mapper.ZcglZcdjAreaMapper;
import jnpf.zc.model.zcglzcdjinfo.ZcglZcdjInfoPagination;
import jnpf.zc.service.ZcglZcdjAreaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
 *
 * 资产登记
 * 版本： V3.2.0
 * 版权： 智果云科技（https://www.jnpfsoft.com）
 * 作者： JNPF开发平台组
 * 日期： 2024-12-19
 */
@Service
public class ZcglZcdjAreaServiceImpl extends ServiceImpl<ZcglZcdjAreaMapper, ZcglZcdjAreaEntity> implements ZcglZcdjAreaService {

        @Autowired
        private GeneraterSwapUtil generaterSwapUtil;

        @Autowired
        private UserProvider userProvider;

        @Autowired
        private AuthorizeService authorizeService;
@Override
public QueryWrapper<ZcglZcdjAreaEntity> getChild(ZcglZcdjInfoPagination pagination, QueryWrapper<ZcglZcdjAreaEntity> zcglZcdjAreaQueryWrapper){
    boolean pcPermission = false;
    boolean appPermission = false;
    boolean	isPc = ServletUtil.getHeader("jnpf-origin").equals("pc");
    if(isPc){
        }

        return zcglZcdjAreaQueryWrapper;
		}

    /**
     * 计算各个面积字段的和
     */
    public Map<String, Double> calculateAreaSums() {
        // 计算各个面积字段的和
        Double buildingAreaSum = this.baseMapper.sumBuildingArea();
        Double landAreaSum = this.baseMapper.sumLandArea();
        Double sharedLandAreaSum = this.baseMapper.sumSharedLandArea();
        Double buildingMeasurementAreaSum = this.baseMapper.sumBuildingMeasurementArea();
        Double landSurveyAreaSum = this.baseMapper.sumLandSurveyArea();

        // 将结果封装到 Map 中
        Map<String, Double> areaSums = new HashMap<>();
        areaSums.put("BUILDING_AREA", buildingAreaSum);
        areaSums.put("LAND_AREA", landAreaSum);
        areaSums.put("SHARED_LAND_AREA", sharedLandAreaSum);
        areaSums.put("BUILDING_MEASUREMENT_AREA", buildingMeasurementAreaSum);
        areaSums.put("LAND_SURVEY_AREA", landSurveyAreaSum);

        return areaSums;
    }
}
